import { IPublicTypeComponentMetadata, IPublicTypeSnippet } from '@alilc/lowcode-types';

const WeatherAlertMeta: IPublicTypeComponentMetadata = {
  componentName: 'WeatherAlert',
  title: '重点城市气象预警',
  category: '信息展示',
  group: '气象防灾',
  docUrl: '',
  screenshot: '',
  devMode: 'proCode',
  npm: {
    package: 'hzdz-charts',
    version: '0.1.0',
    exportName: 'WeatherAlert',
    main: 'src/index.tsx',
    destructuring: true,
    subName: ''
  },
  props: [
    {
      name: 'ref',
      propType: 'object',
    },
    {
      name: 'key',
      propType: 'string',
    },
    {
      name: 'style',
      propType: 'object',
    },
    {
      name: 'className',
      propType: 'string',
    },
    {
      name: 'width',
      propType: 'number',
      description: '组件宽度'
    },
    {
      name: 'height',
      propType: 'number',
      description: '组件高度'
    },
    {
      name: 'backgroundColor',
      propType: 'string',
      description: '背景颜色'
    },
    {
      name: 'backgroundOpacity',
      propType: 'number',
      description: '背景透明度'
    },
    {
      name: 'borderRadius',
      propType: 'number',
      description: '边框圆角'
    },
    {
      name: 'iconPath',
      propType: 'string',
      description: '图标路径'
    },
    {
      name: 'timeLabel',
      propType: 'string',
      description: '时间标签'
    },
    {
      name: 'alertTitle',
      propType: 'string',
      description: '告警标题'
    },
    {
      name: 'alertCount',
      propType: 'string',
      description: '告警数量'
    },
    {
      name: 'timeLabelColor',
      propType: 'string',
      description: '时间标签颜色'
    },
    {
      name: 'alertTitleColor',
      propType: 'string',
      description: '告警标题颜色'
    },
    {
      name: 'alertCountColor',
      propType: 'string',
      description: '告警数量颜色'
    },
    {
      name: 'showGradientText',
      propType: 'bool',
      description: '显示渐变文字'
    },
    {
      name: 'gradientColors',
      propType: 'array',
      description: '渐变颜色'
    },
    {
      name: 'theme',
      propType: 'string',
      description: '主题'
    },
    {
      name: 'onIconClick',
      propType: 'func',
      description: '图标点击事件'
    },
    {
      name: 'onContentClick',
      propType: 'func',
      description: '内容点击事件'
    },
    {
      name: 'onClick',
      propType: 'func',
      description: '点击事件'
    }
  ],
  configure: {
    props: [
      {
        name: 'timeLabel',
        title: { label: { type: 'i18n', 'en-US': 'timeLabel', 'zh-CN': '时间标签' } },
        setter: { componentName: 'StringSetter', isRequired: false, initialValue: '1小时圈' }
      },
      {
        name: 'alertTitle',
        title: { label: { type: 'i18n', 'en-US': 'alertTitle', 'zh-CN': '告警标题' } },
        setter: { componentName: 'StringSetter', isRequired: false, initialValue: '重点城市气象告警' }
      },
      {
        name: 'alertCount',
        title: { label: { type: 'i18n', 'en-US': 'alertCount', 'zh-CN': '告警数量' } },
        setter: { componentName: 'StringSetter', isRequired: false, initialValue: '0' }
      },
      {
        name: 'iconPath',
        title: { label: { type: 'i18n', 'en-US': 'iconPath', 'zh-CN': '图标路径' } },
        setter: { componentName: 'StringSetter', isRequired: false, initialValue: 'http://localhost:8085/static/images/qixiangfangzhai/bz14.png' }
      },
      {
        name: 'backgroundColor',
        title: { label: { type: 'i18n', 'en-US': 'backgroundColor', 'zh-CN': '背景颜色' } },
        setter: { componentName: 'ColorSetter', isRequired: false, initialValue: '#586570' }
      },
      {
        name: 'timeLabelColor',
        title: { label: { type: 'i18n', 'en-US': 'timeLabelColor', 'zh-CN': '时间标签颜色' } },
        setter: { componentName: 'ColorSetter', isRequired: false, initialValue: '#FFFFFF' }
      },
      {
        name: 'alertTitleColor',
        title: { label: { type: 'i18n', 'en-US': 'alertTitleColor', 'zh-CN': '告警标题颜色' } },
        setter: { componentName: 'ColorSetter', isRequired: false, initialValue: 'rgba(255,255,255,0.8)' }
      },
      {
        name: 'alertCountColor',
        title: { label: { type: 'i18n', 'en-US': 'alertCountColor', 'zh-CN': '告警数量颜色' } },
        setter: { componentName: 'ColorSetter', isRequired: false, initialValue: '#1AD7FF' }
      },
      {
        name: 'showGradientText',
        title: { label: { type: 'i18n', 'en-US': 'showGradientText', 'zh-CN': '显示渐变文字' } },
        setter: { componentName: 'BoolSetter', isRequired: false, initialValue: true }
      }
    ],
    supports: {
      style: true
    }
  }
};

const snippets: IPublicTypeSnippet[] = [
  {
    title: '重点城市气象预警',
    screenshot: '',
    schema: {
      componentName: 'WeatherAlert',
      props: {
        width: 220,
        height: 48,
        backgroundColor: '#586570',
        backgroundOpacity: 0.38,
        borderRadius: 4,
        iconPath: 'http://localhost:8085/static/images/qixiangfangzhai/bz14.png',
        iconSize: { width: 32, height: 32 },
        timeLabel: '1小时圈',
        alertTitle: '重点城市气象告警',
        alertCount: '0',
        timeLabelColor: '#FFFFFF',
        alertTitleColor: 'rgba(255,255,255,0.8)',
        alertCountColor: '#1AD7FF',
        showGradientText: true,
        gradientColors: ['#FFFFFF', '#81C6FF'],
        fontSize: {
          timeLabel: 14,
          alertTitle: 14,
          alertCount: 24
        },
        fontWeight: {
          timeLabel: 500,
          alertTitle: 400,
          alertCount: 'bold'
        },
        theme: 'dark'
      }
    }
  }
];

export default {
  ...WeatherAlertMeta,
  snippets
}; 